#include "rectangle.h"

Rectangle::Rectangle()
{
    this->vertex = Point(0,0);
    this->width  = 0;
    this->height = 0;
}

Rectangle::Rectangle(const Point &inputVertex, const int &inputWidth, const int &inputHeight)
{
    this->vertex = inputVertex;
    this->width  = inputWidth;
    this->height = inputHeight;
}

Rectangle::Rectangle(const int &x, const int &y, const int &inputWidth, const int &inputHeight)
{
    this->vertex = Point(x, y);
    this->width  = inputWidth;
    this->height = inputHeight;
}

void Rectangle::moveShape(const int &x, const int &y)
{
    this->vertex += Point(x, y);
}

void Rectangle::extensionShape(const double &scale)
{
    int tempH = this->height;
    int tempW = this->width;
    this->height *= scale;
    this->width  *= scale;
    this->vertex += Point((tempW-this->width),(tempH-this->height));
}

int Rectangle::getHeight()
{
    return this->height;
}

int Rectangle::getWidth()
{
    return this->width;
}

Point Rectangle::getVertex()
{
    return this->vertex;
}

std::string Rectangle::saveData()
{
    std::string res = "r " ;
    res += std::to_string(this->vertex.getX());
    res += " ";
    res += std::to_string(this->vertex.getY());
    res += " ";
    res += std::to_string(this->width);
    res += " ";
    res += std::to_string(this->height);
    res += '\n';
    return res;
}

Rectangle::~Rectangle()
{

}

